<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>键盘事件</title>
    <!-- 1.导入vue.js -->
<script src="../js/vue.js"></script>
</head>
<body>
    <!-- 2准备一个容器，用于渲染data 的数据 -->
    <div id="root">
        <h2>欢迎来到{{name}}学习</h2>
        <input type="text" placeholder="按下回车提示输入" 
                        @keydown.esc="showInfo">
    </div>
</body>
<!-- 3.实例化Vue实例对像 -->
<script>
    Vue.config.productionTip = false
    new Vue({
        el:'#root',
        data:{
            name:'浙江理工大学'
        },
        methods: {
            showInfo(e){
                // console.log(e.key,e.keyCode)
                console.log(e.target.value)
            }
        },
    })
</script>
</html>